/*
 * ====================================================================
 * Copyright (c) 2002-2018 The RapidSVN Group.  All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (in the file GPL.txt).
 * If not, see <http://www.gnu.org/licenses/>.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://rapidsvn.tigris.org/.
 * ====================================================================
 */
#ifndef _ACTION_WORKER_H_
#define _ACTION_WORKER_H_

// forward declarations
class SvnAction;
class NormalAction;
class GitAction;
class wxWindow;
class Tracer;
class AbstractAction;
class GitContext;

namespace svn
{
    class Context;
}

enum ActionState {
    ACTION_NONE,
    ACTION_INIT,
    ACTION_RUNNING
};

enum ActionResult {
    ACTION_NOTHING,
    ACTION_ABORTED,
    ACTION_ERROR,
    ACTION_SUCCESS
};

enum WorkerType {
    SIMPLE_WORKER, SVN_WORKER, CONTEXT_WORKER
};
/***
 * AbstractActionWorker:
 *
 * ActionWorker:
 *
 * SvnThreadedWorker
 *
 * ThreadedWorker
 *
 * Context
 * Perform
 * no dependency
 */
class AbstractActionWorker
{
public:

    virtual void Create ( wxWindow * parent ) = 0;

    virtual ActionState GetState() = 0;

    virtual ActionResult GetResult() = 0;

    virtual void SetTracer ( Tracer * tr ) = 0;

    virtual bool Perform ( AbstractAction * abstractAction ) = 0;

    virtual ~AbstractActionWorker() = default;;
protected:
    WorkerType workerType;
};


/**
 * this is the full abstract class of the action
 * worker. it is used to get a unique calling interface.
 * use either the implementation SimpleWorker or
 * SvnThreadedWorker
 *
 * @see SimpleWorker
 * @see SvnThreadedWorker
 */
class ActionWorker
{
public:

    virtual void Create ( wxWindow * parent ) = 0;

    virtual ActionState GetState() = 0;

    virtual ActionResult GetResult() = 0;

    virtual void SetTracer ( Tracer * tr ) = 0;

    virtual bool Perform ( SvnAction * action ) = 0;
    virtual bool Perform ( NormalAction * action ) = 0;
    virtual bool Perform ( GitAction * action ) = 0;
    //own
    virtual void SetSvnContext ( svn::Context * context, bool own = false ) = 0;

    //
    virtual void SetGitContext ( GitContext* context, bool own = false ) = 0;

    virtual svn::Context * GetSvnContext() const = 0;

    virtual GitContext * GetGitContext() const = 0;

    virtual ~ActionWorker() = default;
};




#endif
/* -----------------------------------------------------------------
 * local variables:
 * eval: (load-file "../rapidsvn-dev.el")
 * end:
 */
